

import java.util.Scanner;

public abstract class Car {
    private String name;
    private String plate;
    private double money;
    private int day;
    public Car(){}
    public Car(String name, String plate, double money, int day) {
        this.name = name;
        this.plate = plate;
        this.money = money;
        this.day = day;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPlate() {
        return plate;
    }

    public void setPlate(String plate) {
        this.plate = plate;
    }

    public double getMoney() {
        return money;
    }

    public void setMoney(double money) {
        this.money = money;
    }

    public int getDay() {
        return day;
    }

    public void setDay(int day) {
        this.day = day;
    }
    public abstract void show();
}

class TestCar{
    public static void main(String[] args) {
        Scanner input =new Scanner(System.in);
        System.out.println("************欢迎光临腾飞汽车租赁公司**************");
        System.out.println("1、轿车 2、客车");
        System.out.println("请选择你要租赁的汽车类型：");
        int num=input.nextInt();
        switch (num){
            case 1:
                Car car=new Limousine();
                System.out.println("请选择你要租赁的汽车品牌：1、宝马x6\t2、宝马550i\t3、别克林荫大道\t4、别克GL8");
                int sam=input.nextInt();
                while (sam==1||sam==2||sam==3||sam==4){
                if (sam==1){
                    car.setName("宝马x6");
                   car.setMoney(800);
                   car.setPlate("京NY28588");
                }
                else if (sam==2){
                    car.setName("宝马550i");
                    car.setMoney(600);
                    car.setPlate("京CN3284");
                }
                else if (sam==3){
                    car.setName("别克林荫大道");
                    car.setMoney(300);
                    car.setPlate("京NT37465");
                }
                else if (sam==4){
                    car.setName("别克GL8");
                    car.setMoney(600);
                    car.setPlate("京NT96968");
                }
                System.out.print("请输入您要租赁的天数：");
                int sum=input.nextInt();
                car.setDay(sum);
                car.show();
                System.out.println("分配给您的汽车牌号："+car.getPlate());
                System.out.println("您需要支付的租赁费用是："+car.getMoney());
                break;
                }
                break;
            case 2:
                Car car1=new PassengerCar();
                System.out.print("请选择你要租赁的汽车品牌：1、金龙\t2、金杯");
                 sam=input.nextInt();
                 while (sam==1||sam==2){
                if (sam==1){
                    car1.setName("金龙");
                    System.out.println("请选择租赁的汽车座位数：1、16座\t2、34座");
                    int mul=input.nextInt();
                    if (mul==1){
                    car1.setMoney(800);
                    car1.setPlate("京8696997");}
                    else if (mul==2){
                        car1.setMoney(1500);
                        car1.setPlate("京8696998");
                    }
                }
                else if (sam==2){
                    car1.setName("金杯");
                    System.out.println("请选择租赁的汽车座位数：1、16座\t2、34座");
                    int mul=input.nextInt();
                    if (mul==1){
                        car1.setMoney(800);
                        car1.setPlate("京6566754");}
                    else if (mul==2){
                        car1.setMoney(1500);
                        car1.setPlate("京9696996");
                    }
                }

                System.out.print("请输入您要租赁的天数：");
                 int sum=input.nextInt();
                car1.setDay(sum);
                car1.show();
                System.out.println("分配给您的汽车牌号："+car1.getPlate());
                System.out.println("您需要支付的租赁费用是："+car1.getMoney()+"元");
                break;}
                break;
            default:
                System.out.println("没有你先要的车型");
                break;
        }
    }
}
